home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / dosutils / cluster2.zip / CLUSTERS.TXT < prev    next >
Text File  |  1996-07-06  |  8KB  |  164 lines

  1.                           Clusters V2.0
  2.  
  3.  
  4. +--------------------------------------+
  5. | First, some background               |
  6. +--------------------------------------+
  7.  
  8. A "cluster" is smallest unit of disk space that can be allocated to a
  9. file.  When you format a disk (either a floppy or a hard disk), the
  10. format program marks off the clusters, and creates a "road map",
  11. called the file allocation table, (or FAT), that DOS uses to keep
  12. track of where your files are stored.  In the early days of computers,
  13. when DOS was designed, hard disk storage was *very* expensive;  no one
  14. even dreamed of the 1 gigabyte drives we have today.  So, in the
  15. interest of saving a little room in the operating system, DOS was
  16. designed so that it can only keep track of about 65,000 clusters in
  17. the FAT.
  18.  
  19. The actual number of bytes in a cluster depends on the size of the
  20. hard disk partition being formatted. Pretend you only know how to cut
  21. a pie into eight pieces.  If you cut up a 6 inch pie, then cut up a 12
  22. inch pie, each pie has only eight pieces, but obviously the 12 inch
  23. pie has bigger pieces.  The same thing happens to hard disks.  The
  24. clusters on small hard disks have relatively small sizes;  on larger
  25. hard disks, the clusters may be very big.  For example, on a 200MB
  26. hard disk, the cluster size is 4K, or 4,096 bytes. On a 1.6 gigabyte
  27. (1600MB) hard drive, the cluster size is 32K, or eight times as big.
  28.  
  29. Remember that earlier I said that a cluster is the smallest amount of
  30. disk space that can be given to a file. Files bigger than the cluster
  31. size are simply allocated as many clusters as needed to store them.  A
  32. 2Kbyte file, for example, always takes up one cluster.  In our
  33. examples from just a minute ago, that means that on the 200MB hard
  34. drive, it is allocated 4K, leaving about 2K unused.  This unused
  35. portion is called "slack space".  Virtually every file on your hard
  36. drive will have some slack space, because none of them will neatly fit
  37. exactly into a multiple of the cluster size of your hard disk.  But on
  38. a large hard drive, that same small file (2K), is allocated a single
  39. cluster of 32K of space -- 30K of disk real estate is wasted!
  40.  
  41. I have been using small files in my examples.  As we all know, some
  42. files on your system are very large. A large file wastes very little
  43. disk space, relatively speaking.   On a disk with 32K clusters, a file
  44. with 2,353,234 bytes (about 2.3MB) will have approximately 72 clusters
  45. allocated to it, with 26K of slack space in the last one, or a waste
  46. of about 0.1%.  Not bad.  The trick, though, if figuring out whether
  47. or not you are making good use of the space on your disk.
  48.  
  49.  
  50. +-------------------------------------------+
  51. |  What CLUSTERS does                       |
  52. +-------------------------------------------+
  53.  
  54. The CLUSTERS utility can examine all of the files on a given drive
  55. hard drive (or a subdirectory), and reports the amount of space
  56. allocated, space used, and space wasted.  It is a great diagnostic
  57. tool to see how much of your hard disk is going to waste because of
  58. the size of it's clusters.  After examining a drive, CLUSTERS can
  59. optionally show you a list of the directories on the drive, with a
  60. breakdown done by directory. This information can help you plan how to
  61. arrange the files and directories in your system if you have more than
  62. one hard drive or partition.
  63.  
  64. Using the utility is simple.  Enter the command CLUSTERS at the DOS
  65. prompt, and tell it which drive you would like to examine.  The
  66. program then looks at the drive and displays a running total of what
  67. it's found.  On the main screen, it will display all the possible
  68. cluster sizes, and how much waste you would have under each one.  The
  69. cluster size that your hard disk is currently using is highlighted.
  70.  
  71.  
  72. +-------------------------------------------+
  73. |  What you should have                     |
  74. +-------------------------------------------+
  75.  
  76. The zip file CLUSTERS2.ZIP should contain the following files:
  77.  
  78.     CLUSTERS.TXT   -- this file
  79.     CLUSTERS.EXE   -- the executable program
  80.     SOURCE.ZIP     -- a zip file that contains the PowerBASIC source
  81.                       code for clusters.
  82.  
  83.     SOURCE.ZIP will contain:
  84.  
  85.        CLUSTER2.BAS  --  The source code for CLUSTERS
  86.        PB3BOXES.PBL  --  A library of window routines used by CLUSTERS
  87.        PB3BOXES.BU   +
  88.        VERTMENU.BU   |
  89.        BOXMGR.BU     +-- Source for the PB3Boxes Library
  90.        PB3BOXES.INC  |
  91.        PB3BOXES.HDR  +
  92.        PB3BOXES.TXT  --  Readme for same
  93.  
  94.  
  95. +-------------------------------------------+
  96. |  Legal stuff                              |
  97. +-------------------------------------------+
  98.  
  99. CLUSTERS and it's associated source code are free for use, but are not
  100. public domain.  That means that you are free to use, copy and
  101. distribute CLUSTERS, provided that:
  102.  
  103.    1) You do not profit from it
  104.    2) All copyright notices embedded in the source code and executable
  105.       files remain intact.
  106.  
  107. Portions of the source code for PB3BOXES are copyright PowerBASIC,
  108. INC, and are distributed with permission.  All other code remains
  109. Copyright of Nathan C. Durland III.
  110.  
  111.  
  112. +------------------------------------------------+
  113. | How do I reduce the waste on my hard drive?    |
  114. +------------------------------------------------+
  115.  
  116. Setting up a hard disk for use with DOS, Windows, or Windows95 is a
  117. two stage process.  First, a utility called FDISK is used to create
  118. partitions on the hard disk.  DOS then assigns a drive letter to each
  119. partition. Generally speaking, new computers come setup with the hard
  120. disk configured as one large partition.  The partition is then
  121. formatted using the FORMAT utility.  Format examines the partition,
  122. and selects a cluster size based on it's size.
  123.  
  124. If you discover that your hard drive is wasting a great deal of space
  125. because it has clusters that are too large, you must reduce the size
  126. of the partition using FDISK and FORMAT.  Here is a guide for
  127. partition and cluster sizes:
  128.  
  129.           Partition size              Cluster size
  130.              0MB -  128MB               2048 bytes
  131.            129MB -  256MB               4096 bytes
  132.            257MB -  512MB               8192 bytes
  133.            513MB - 1.02GB              16284 bytes
  134.           1.02GB - 2.04GB             32768 bytes
  135.  
  136.  
  137. +--------------------------------------------------------------------+
  138. |  Remember:  USING FDISK DESTROYS ALL THE DATA ON YOUR HARD DRIVE.  |
  139. |  Make sure you have backups before you begin.  Enlist the help of  |
  140. |  your computer dealer if you are unsure of how to proceed.         |
  141. +--------------------------------------------------------------------+
  142.  
  143.  
  144. If you find this utility useful, please let me know.  My E-Mail address
  145. is bdurland@northnet.org, or you can FAX comments to (518) 834-9934.
  146.  
  147.  
  148. +-------------------------------------------+
  149. |  Legal stuff                              |
  150. +-------------------------------------------+
  151.  
  152. CLUSTERS and it's associated source code are free for use, but are not
  153. public domain.  That means that you are free to use, copy and
  154. distribute CLUSTERS, provided that:
  155.  
  156.    1) You do not profit from it
  157.    2) All copyright notices embedded in the source code and executable
  158.       files remain intact.
  159.  
  160. Portions of the source code for PB3BOXES are copyright PowerBASIC,
  161. INC, and are distributed with permission.  All other code remains
  162. Copyright of Nathan C. Durland III.
  163.  
  164.